home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 10
/
AACD 10.iso
/
AACD
/
Programming
/
AmigaTalk
/
general
/
Object.st
< prev
next >
Wrap
Text File
|
2000-02-27
|
3KB
|
113 lines
"-----------------------------------------------------------------"
" Object Class is the Root of all other Classes in AmigaTalk. "
"-----------------------------------------------------------------"
Class Object
[
== anObject
^ <primitive 7 self anObject >
|
~~ x
^ (self == x) not
|
= x
^ (self == x) "Is the receiver equal to x??"
|
~= x
^ (self = x) not "Is the receiver NOT equal to x??"
|
asString
^ <primitive 152 (self class)> "Avoid recursion!"
"^ self class printString" "<<--Infinite recursive method."
|
asSymbol
^ self asString asSymbol "Return the class a Symbol."
|
class
^ <primitive 1 self >
|
copy
^ self shallowCopy
|
deepCopy ! size newobj !
size <- <primitive 4 self>.
(size < 0)
ifTrue: [^ self] "if special just copy object"
ifFalse: [ newobj <- self class new.
(1 to: size) do: [:i |
<primitive 112 newobj i ( <primitive 111 self i > copy ) > ].
^ newobj ]
|
do: aBlock ! item !
item <- self first.
^ [item notNil] whileTrue:
[aBlock value: item. item <- self next]
|
error: aString
<primitive 122 aString self>
|
first
^ self
|
isKindOf: aClass ! objectClass !
objectClass <- self class.
[objectClass notNil] whileTrue:
[(objectClass == aClass) ifTrue: [^ true].
objectClass <- objectClass superClass].
^ false
|
isMemberOf: aClass
^ aClass == self class
|
isNil
^ false
|
next
^ nil
|
notNil
^ true
|
print
<primitive 121 (self printString) >
|
printString
^ self asString
|
respondsTo: cmd
^ self class respondsTo: cmd
|
shallowCopy ! size newobj !
size <- <primitive 4 self>.
(size < 0)
ifTrue: [^ self] "if special just copy object"
ifFalse: [ newobj <- self class new.
(1 to: size) do: [:i |
<primitive 112 newobj i <primitive 111 self i > > ].
^ newobj ]
|
subclassResponsibility: methodString ! msg !
msg <- String new: 'Method ',methodString,' should be implemented in a SubClass!'.
^ <primitive 181 13 msg 'User ERROR:' 'OKAY'>
|
notImplemented: methodString ! msg !
msg <- String new: 'Method ',methodString,' NOT implemented!'.
^ <primitive 181 13 msg 'User ERROR:' 'OKAY'>
|
doesNotUnderstand: methodString ! msg !
msg <- String new: 'Method ',methodString,' NOT understood!'.
^ <primitive 181 13 msg 'User ERROR:' 'OKAY'>
|
shouldNotImplement: methodString ! msg !
msg <- String new: 'Method ',methodString,' should NOT BE implemented!'.
^ <primitive 181 13 msg 'User ERROR:' 'OKAY'>
]